package com.siloam.vo;

import com.siloam.module.GroupUser;
import com.siloam.module.User;

public class UserVO {
	private int id;
	private String name;
	private String username;
	private String status;
	private String qq;
	private String opt;
	private String memberType;
	
	public UserVO() {

	}

	public UserVO(User user) {
		setId(user.getId());
		setName(user.getName());
		setUsername(user.getUsername());
		setStatus(user.getStatusText());
		setQq(user.getQq());
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getOpt() {
		return opt;
	}

	public void setOpt() {
		StringBuffer buff = new StringBuffer();
		buff.append("<a href='#' ");
		buff.append(" title='编辑'><img src='../../img/edit.png'/></a>");
		buff.append("&nbsp;&nbsp;");
		buff.append("<a href='#' ");
		buff.append(" title='删除'><img src='../../img/delete.png'/></a>");
		this.opt = buff.toString();
	}
	
	public void setLeaderOpt(GroupUser gu){
		StringBuffer buff = new StringBuffer();
		buff.append("<a href='javascript:;' onclick='setMemberType(").append(gu.getId()).append(",");
		if(gu.isLeader()){
			buff.append(GroupUser.TYPE_MEMBER).append(")' ");
			buff.append(" title='设置为成员'><img src='../../img/edit.png'/></a>");	
		} else {
			buff.append(GroupUser.TYPE_LEADER).append(")' ");
			buff.append(" title='设置为组长'><img src='../../img/edit.png'/></a>");
		}
		this.opt = buff.toString();
	}

	public String getQq() {
		return qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	public String getMemberType() {
		return memberType;
	}

	public void setMemberType(String memberType) {
		this.memberType = memberType;
	}

}
